from transformers.models.deberta import DebertaModel, \
    DebertaForSequenceClassification, DebertaTokenizer, DebertaConfig

from transformers.models.deberta_v2 import DebertaV2Model, \
    DebertaV2ForSequenceClassification, DebertaV2Tokenizer

import paddle
from collections import OrderedDict

linear_names = [
    'in_proj.weight',
    'pos_proj.weight',
    'pos_q_proj.weight',
    'dense.weight',
]

save_sd = OrderedDict()

for name, weight in sd.items():
    weight = weight.numpy()
    if any(n in name for n in linear_names):
        weight = weight.transpose()
    save_sd[name] = weight
